﻿<UserControl
    x:Class="ProjectBilling.UI.SL.ProjectsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:ProjectBilling.UI.SL" 
    MinHeight="180" Height="180" MinWidth="250" Width="250">

    <UserControl.Resources>
        <local:StatusToBrushConverter x:Key="StatusToBrush" />
    </UserControl.Resources>
    <Border BorderBrush="Blue" BorderThickness="5" 
            Margin="10" Padding="5" CornerRadius="5">
        <Grid Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <TextBlock Text="Project:" />
            <ComboBox Margin="5" Grid.Column="1"
                    SelectionChanged
                      ="ComboBox_SelectionChanged"
                    ItemsSource="{Binding Path=Projects}"
                    DisplayMemberPath="Name"
                    SelectedValuePath="ID" />
            <TextBlock Text="Estimated Cost:" Grid.Row="1"/>
            <TextBox Margin="5" Grid.Row="1" Grid.Column="1" 
                    IsEnabled="{Binding 
                        Path=DetailsEnabled}" 
                    Text="{Binding 
                        Path=SelectedProject.Estimate,
                        Mode=TwoWay}"
                    Foreground="{Binding 
                        Path=DetailsEstimateStatus,
                        Converter={StaticResource 
                            StatusToBrush}}"/>
            <TextBlock Text="Actual Cost:" Grid.Row="2" />
            <TextBox Margin="5" Grid.Row="2" Grid.Column="2" 
                     IsEnabled="{Binding 
                        Path=DetailsEnabled}" 
                     Text="{Binding 
                        Path=SelectedProject.Actual,
                        Mode=TwoWay}" />
            <Button Content="Update" Margin="5" Grid.Row="3"
                    Grid.ColumnSpan="2"
                    Command="{Binding Path=UpdateCommand}" />
        </Grid>
    </Border>
</UserControl>
